<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<title>我的易安</title>
		<%@ include file="/user_comm.jsp"%>
		<script language="JavaScript" src="<%=request.getContextPath()%>/js/dataCheck.js"></script>
		
		<link rel="stylesheet"
			href="http://a.tbcdn.cn/apps/sell/1.0/publish_detail_ke.css?t=20110128editor.css" />
		<!-- script start -->

		<style type="text/css">
<!--
#order_save label {
	width: 250px;
}

#order_save label.error,#order_save input.submit {
	margin-left: 253px;
}

#signupForm {
	width: 670px;
}

#signupForm label.error {
	margin-left: 10px;
	width: auto;
	display: inline;
}

#newsletter_topics label.error {
	display: none;
	margin-left: 103px;
}
-->
</style>

		<script>

$().ready(function() {
	// validate signup form on keyup and submit
	var sid=$d("hdfSid").value;
	if(sid==1){
		$("#order_save").validate({
			rules: {
				amount: "required",
				seqLen: "required",
				trademark: {
					required: false,
					minlength: 3
				}			
			},
			messages: {
				firstname: "请输入订购数量",
				seqLen: "请输入封条编码位数",
				trademark: {
					minlength: "请至少输入3位商标信息"
				}			
			}
		});
	}
});

	function ReCaculate(orderNum){
		//验证输入值是否合法(正整数)
		if(!isNumber(orderNum)){
			$d("amountError").innerHTML="请输入正确的订购数量";
			return;
		}
		//判断订购数量必须大于等于最小订购数量
		var minOrderNum=$d("hdfMinOrderNum").value;
		if(orderNum<minOrderNum)
		{
			$d("amountError").innerHTML="订购数量不能小于"+minOrderNum;
			return;
		}
		//更新赠送积分值及订单总金额
		var price=$d("hdfPrice").value;
		var score=$d("hdfScore").value;
		var discount=$d("hdfDiscount").value;
		
		var totalprice=price * orderNum * discount;
		var totalscore=score * orderNum;
		$d("totalprice").innerHTML=totalprice;
		$d("totalscore").innerHTML=totalscore;
		$d("amountError").innerHTML="";
	}
</script>
		<!-- script end -->
	</head>
	<body>
		<%@ include file="/user_top.jsp"%>
		<div class="realCer">
			<!--导航-->
			<!--主体部分start-->
			<div class="realMain clearfix mt10">
				<%@ include file="/user_menu.jsp"%>
				<div class="realRight ml10 Buyer">
					<div class="mybox">
						<div class="mytit">
							产品订购
						</div>
						<div class="con">
									<s:form name="formpage" action="order_save" namespace="/">
										<s:token>
										</s:token>
										<div>
											<table border="0" cellpadding="0" cellspacing="1">
												<tr>
													<td width="200px" valign="top">
														<table width="100%" border="0" cellpadding="0"
															cellspacing="1">
															<tr>
																<td>
																	商品信息
																</td>
															</tr>
															<tr>
																<td align="center">
																	<img height="180" width="180" alt="商品图片"
																		src="<%=request.getContextPath()%>/upload/seal/s_${product.image1}" />
																</td>
															</tr>
															<tr>
																<td>
																	<table border="0" cellpadding="0" cellspacing="1">
																		<tr>
																			<td align="right">
																				<input type="hidden" id="productId"
																					name="orderInfo.productId"
																					value="${orderInfo.productId}" />
																				商品名称：
																			</td>
																			<td>
																				${orderInfo.productName}
																			</td>
																		</tr>
																		<tr>
																			<td align="right">
																				型号：
																			</td>
																			<td>
																				${orderInfo.type}
																			</td>
																		</tr>
																		
																		<s:if test='1==#request.orderInfo.sid'>
																		<tr>
																			<td align="right">
																				颜色：
																			</td>
																			<td>
																				<input type="hidden" name="orderInfo.color"
																					value="${orderInfo.color}" />
																				${orderInfo.color}
																			</td>
																		</tr>
																		</s:if>
																		
																		<tr>
																			<td align="right">
																				单价：
																			</td>
																			<td>
																				<input type="hidden" id="hdfSid"
																					value="${orderInfo.sid}" />
																				<input type="hidden" id="hdfPrice"
																					value="${orderInfo.price}" />
																				<input type="hidden" id="hdfScore"
																					value="${orderInfo.score}" />
																				<input type="hidden" id="hdfDiscount"
																					name="orderInfo.discount"
																					value="${orderInfo.discount}" />
																				${orderInfo.price}
																				<s:if test='"RMB"==#request.orderInfo.currtype'>
														元
													</s:if>
																				<s:elseif test='"USD"==#request.orderInfo.currtype'>
														美元
													</s:elseif>
																			</td>
																		</tr>
																	</table>
																</td>
															</tr>
														</table>
													</td>
													<td valign="top">
														<div>
															<table width="100%" border="0" cellpadding="0"
																cellspacing="1">
																<tr>
																	<td colspan="2">
																		确认收货地址
																	</td>
																</tr>
																<tr>
																	<td align="right" width="110">
																		账户代码：
																	</td>
																	<td>
																		${userId }
																	</td>
																</tr>
																<tr>
																	<td align="right" width="110">
																		收货人姓名：
																	</td>
																	<td>
																		<input name="orderInfo.userName" type="text"
																			maxlength="15" size="25"
																			value="${orderInfo.userName }" />
																	</td>
																</tr>
																<tr>
																	<td align="right">
																		手机：
																	</td>
																	<td>
																		<input name="orderInfo.cellphone" type="text"
																			maxlength="11" size="25"
																			value="${orderInfo.cellphone }" />
																	</td>
																</tr>
																<tr>
																	<td align="right">
																		电话：
																	</td>
																	<td>
																		<!-- 
																		<input name="orderInfo.countryCode" type="text"
																			maxlength="5" size="4"
																			value="${orderInfo.countryCode }" />
																		<input name="orderInfo.regionCode" type="text"
																			maxlength="6" size="6"
																			value="${orderInfo.regionCode }" />
																		 -->	
																		<input name="orderInfo.telephone" type="text"
																			maxlength="20" size="25"
																			value="${orderInfo.telephone }" />
																	</td>
																</tr>
																<tr>
																	<td align="right">
																		邮政编码：
																	</td>
																	<td>
																		<input name="orderInfo.postcode" type="text"
																			maxlength="20" size="10"
																			value="${orderInfo.postcode }" />
																	</td>
																</tr>
																<tr>
																	<td align="right" valign="top">
																		收货地址：
																	</td>
																	<td>
																		<textarea name="orderInfo.address" id="address"
																			cols="50" rows="3"
																			style="width: 360px; height: 50px;">${orderInfo.address }</textarea>
																	</td>
																</tr>
															</table>
														</div>
														<div>
															<table width="100%" border="0" cellpadding="0"
																cellspacing="1">
																<tr>
																	<td colspan="2">
																		确认订购信息
																	</td>
																</tr>
																<tr>
																	<td align="right" width="110">
																		订购数量：
																	</td>
																	<td>
																		<input id="amount" name="orderInfo.amount" type="text"
																			maxlength="8" size="10" value="${orderInfo.amount }"
																			onPropertyChange="ReCaculate(this.value);" />
																		(最小订购数量${product.minOrderNum}条)
																		<input type="hidden" id="hdfMinOrderNum"
																			value="${product.minOrderNum}" />
																		<span id="amountError"></span>
																	</td>
																</tr>
																
																<s:if test='1==#request.orderInfo.sid'>
																<tr>
																	<td align="right">
																		编码位数：
																	</td>
																	<td>
																		<input id="sqlLen" type="text" name="orderInfo.seqLen"
																			size="10" maxlength="10" value="${orderInfo.seqLen }" />
																	</td>
																</tr>
																<tr>
																	<td align="right" width="110">
																		商标：
																	</td>
																	<td>
																		<input id="trademark" type="text" size="10"
																			maxlength="10" name="orderInfo.trademark"
																			value="${orderInfo.trademark }" />
																	</td>

																</tr>
																<tr>
																	<td align="right" rowspan="2">
																		封条编码规则：
																	</td>
																	<td>
																		<input type="radio" id="roleType1"
																			name="orderInfo.roleType" value="01" />
																		全数字
																	</td>
																</tr>
																<tr>
																	<td>
																		<input type="radio" size="15" maxlength="15"
																			id="roleType2" name="orderInfo.roleType" value="02" checked/>
																		字母前辍
																		<!-- 封条上的字母全部转成大写 -->
																		<input id="seqChar" type="text" size="5" maxlength="4"
																			name="orderInfo.seqChar" title="字母前辍"
																			value="${orderInfo.seqChar }" ;
																		/>
																	</td>
																</tr>
																</s:if>
																
																<tr>
																	<td align="right" valign="top">
																		订单留言：
																	</td>
																	<td>
																		<textarea name="orderInfo.message" id="message"
																			cols="50" rows="4"
																			style="width: 360px; height: 70px;">${orderInfo.message }</textarea>
																	</td>
																</tr>
															</table>
														</div>
														<div>
															可获积分：<span id="totalscore">${orderInfo.totalscore} </span> 点
															订单金额：<span id="totalprice">${orderInfo.totalprice} </span>
															<s:if test='"RMB"==#request.orderInfo.currtype'>
									元
								</s:if>
															<s:elseif test='"USD"==#request.orderInfo.currtype'>
									美元
								</s:elseif>
															<br />
															<br />
															<input type="submit" id="ok" name="ok" value=" 确 定 "
																class="button" />
														</div>
													</td>
												</tr>
											</table>
										</div>
									</s:form>
						</div>
					</div>
					<div>
					</div>
					<!--主体部分end-->
				</div>
			</div>
		</div>
		<!--底部 start-->
		<%@ include file="/user_button.jsp"%>
		<!--底部end-->
	</body>
</html>
